home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
PowerPlant
/
DMultiStringLocator
/
source
/
PPShell.cp
< prev
next >
Wrap
Text File
|
1996-07-02
|
4KB
|
160 lines
// ===========================================================================
// PPShell.cp
// ---------------------
// ©1996 Eric Gundrum, All rights reserved.
// The contents of this file may be freely altered and freely distributed
// in any form, provided this copyright statement is retained unaltered.
// Add your own changes below.
// ---------------------
//
// This file contains the starter code for a PowerPlant application
#include "PPShell.h"
#include "CSearchWindow.h"
#include <LGroupBox.h>
#include <LGrowZone.h>
#include <LWindow.h>
#include <PP_Messages.h>
#include <PP_Resources.h>
#include <PPobClasses.h>
#include <UDrawingState.h>
#include <UMemoryMgr.h>
#include <URegistrar.h>
#include <LEditField.h>
#include <UDebugging.h>
#define RegisterPPob( className, funcName ) \
URegistrar::RegisterClass( className::class_ID , (ClassCreatorFunc) ( className::funcName ) );
// ===========================================================================
// • Main Program
// ===========================================================================
void main(void)
{
#define debugAction SourceDebugger // Set Debugging options
#if debugAction == Alert
SetDebugThrow_(debugAction_Alert);
SetDebugSignal_(debugAction_Alert);
#elif debugAction == SourceDebugger
SetDebugThrow_(debugAction_SourceDebugger);
SetDebugSignal_(debugAction_SourceDebugger);
#elif debugAction == Nothing
SetDebugThrow_(debugAction_Alert);
SetDebugSignal_(debugAction_Nothing); // turn off Assert_()
#endif // debugAction
InitializeHeap(3); // Initialize Memory Manager
// Parameter is number of Master Pointer
// blocks to allocate
// Initialize standard Toolbox managers
UQDGlobals::InitializeToolbox(&qd);
new LGrowZone(20000); // Install a GrowZone function to catch
// low memory situations.
PPShell theApp; // replace this with your App type
theApp.Run();
}
// ---------------------------------------------------------------------------
// • PPShell // replace this with your App type
// ---------------------------------------------------------------------------
// Constructor
PPShell::PPShell()
{
// Register functions to create core PowerPlant classes
RegisterAllPPClasses();
RegisterPPob( LGroupBox, CreateGroupBoxStream );
}
// ---------------------------------------------------------------------------
// • ~PPShell // replace this with your App type
// ---------------------------------------------------------------------------
// Destructor
//
PPShell::~PPShell()
{
}
// ---------------------------------------------------------------------------
// • StartUp
// ---------------------------------------------------------------------------
// This function lets you do something when the application starts up.
// For example, you could issue your own new command, or respond to a system
// oDoc (open document) event.
void
PPShell::StartUp()
{
ObeyCommand(cmd_New, nil); // EXAMPLE, create a new window
}
// ---------------------------------------------------------------------------
// • ObeyCommand
// ---------------------------------------------------------------------------
// Respond to commands
Boolean
PPShell::ObeyCommand(
CommandT inCommand,
void *ioParam)
{
Boolean cmdHandled = true;
switch (inCommand) {
// Deal with command messages (defined in PP_Messages.h).
// Any that you don't handle will be passed to LApplication
case cmd_New:
new CSearchWindow();
break;
default:
cmdHandled = LApplication::ObeyCommand(inCommand, ioParam);
break;
}
return cmdHandled;
}
// ---------------------------------------------------------------------------
// • FindCommandStatus
// ---------------------------------------------------------------------------
// This function enables menu commands.
//
void
PPShell::FindCommandStatus(
CommandT inCommand,
Boolean &outEnabled,
Boolean &outUsesMark,
Char16 &outMark,
Str255 outName)
{
switch (inCommand) {
// Return menu item status according to command messages.
// Any that you don't handle will be passed to LApplication
case cmd_New: // EXAMPLE
outEnabled = true; // enable the New command
break;
default:
LApplication::FindCommandStatus(inCommand, outEnabled,
outUsesMark, outMark, outName);
break;
}
}